jQuery.fn.file = function(fn) {
	return this.each(function() {
		var $element = $(this);
		var $holder = $('<div></div>').appendTo($element).css({
			position		: 'absolute',
			overflow		: 'hidden',
			'-moz-opacity'	: '0',
			filter			: 'alpha(opacity: 0)',
			opacity			: '0',
			zoom			: '1',
			width			: $element.outerWidth()+'px',
			height			: $element.outerHeight()+'px',
			'z-index'		: 1
		});	

		var wid = 0;
		var inp;

		var addInput = function() {
			var current = inp = $holder.html('<input '+(window.FormData ? 'multiple ' : '')+'type="file" style="cursor:pointer; border:none; position:absolute" title="点击上传图片">').find('input');

			wid = wid || current.width();

			current.change(function() {
				current.unbind('change');

				addInput();
				fn(current[0]);
			});
		};
		var position = function(e) {
			$holder.offset($element.offset());					

			if(e) {
				inp.offset({left:e.pageX-wid+25, top:e.pageY-10});						
			}
		};

		addInput();

		$element.mouseover(position);
		$element.mousemove(position);
		position();		
	});
};